<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>仓库信息</title>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
</head>
<script type="text/javascript">
$(function(){
	//搜索框
	$('#warehouse-search').searchbox({
		searcher : function(value,name){
			//alert("value:"+value+",name:"+name);
			//产品名称
			if(name==('kcName')){
				$("#thptb-warehouse").datagrid({
		    		url: 'selectHisInventoryByIfcpName', 
		    		method: 'post', 
		    		queryParams: {
		    			kcName: value
		    		}
				});
			}else if(name==('kcType')){
				//产品类型
				$("#thptb-warehouse").datagrid({
		    		url: 'selectHisInventoryByIfcpType', 
		    		method: 'post', 
		    		queryParams: {
		    			kcType: value
		    		}
				});
			}else if(name==('ckNo')){
				//仓库编号
				$("#thptb-warehouse").datagrid({
		    		url: 'selectHisInventoryById', 
		    		method: 'post', 
		    		queryParams: {
		    			ckNo: value
		    		}
				});
			}else{
				//模糊查询
			}
		}
	});
	
	//刷新
	$("#warehouse-reload").linkbutton({
		onClick:function(){
			$("#thptb-warehouse").datagrid({
	    		url: 'queryHisInventoryByPage', 
	    		method: 'post'
	    	});
		}
	});
	
	//编辑预警值
	$("#warehouse-yjz").linkbutton({
		onClick:function(){
			var rows = $("#thptb-warehouse").datagrid("getSelections");
			if(rows.length == 1){
				$("#win-edityjz").window("open");
				var datas=$('#thptb-warehouse').datagrid('getSelections');
				var kcNo = datas[0].kcNo;
				//alert(kcNo);
				$.getJSON("selectHisInventoryBykcNo", {"kcNo": kcNo}, function(data){
					$("#form-edityjz").form("load", data);
					//$("#cc").combogrid({value: data.class3.cId});
					//alert(data.kcNumber);
					$('#Warning').numberspinner({max:data.kcNumber});
					$('#Warning').numberspinner('setValue',data.kcWarning);
				});
			}else{
				$.messager.alert("温馨提示提示", "请选择一条记录!",'info');
			}
		}
	});
	
	//提交预警值修改
	$('#submit_thpWarning').linkbutton({
		onClick: function(){
			$('#form-edityjz').form('submit', {
				url: 'editHisInventoryInfo',
			    success:function(data){
		    		$.messager.alert("温馨提示", "预警值修改成功!",'info');
					//关闭窗口
					$('#win-edityjz').window('close');
					//重新加载数据
					$("#thptb-warehouse").datagrid("reload");
					$('#form-edityjz').form("clear");
			    }
			});
		}
	});
	
	//采购计划
	$('#warehouse-cgjh').linkbutton({
		onClick: function(){
			//alert(13);
			$('#win-purchase').window({
				
				'href':"toThpQiXieHisPurchase"
			});
			$('#win-purchase').window('open');
		}
	});
	
	//验收
	$('#warehouse-ys').linkbutton({
		onClick: function(){
			$('#win-CheckAndAccept').window({
				'href':"toThpQiXieHisCheckandaccept"
			});
			$('#win-CheckAndAccept').window('open');
		}
	});
	
	//入库
	$('#warehouse-rk').linkbutton({
		onClick: function(){
			$('#win-QiXieInstorage').window({
				'href':"toThpQiXieHisInstorage"
			});
			$('#win-QiXieInstorage').window('open');
		}
	});
	
	//退货
	$('#warehouse-th').linkbutton({
		onClick: function(){
			$('#win-QiXieReturnGoods').window({
				'href':"toQiXieHisReturngood"
			});
			$('#win-QiXieReturnGoods').window('open');
		}
	});
	
	//出库
	$('#warehouse-ck').linkbutton({
		onClick: function(){
			$('#win-InstrumentLibrary').window({
				'href':"toQiXieHisInstrumentLibrary"
			});
			$('#win-InstrumentLibrary').window('open');
		}
	});
	
	//领用
	$('#warehouse-ly').linkbutton({
		onClick: function(){
			$('#win-QiXieUse').window({
				'href':"toQiXieHisDetailsofequipment"
			});
			$('#win-QiXieUse').window('open');
		}
	});
	
	//还回
	$('#warehouse-hh').linkbutton({
		onClick: function(){
			$('#win-QiXieReturn').window({
				'href':"toThpQiXieHisDetailsofreturn"
			});
			$('#win-QiXieReturn').window('open');
		}
	});
	
	//调拨
	$('#warehouse-db').linkbutton({
		onClick: function(){
			$('#win-QiXieAllocation').window({
				'href':"toThpQiXieAllocation"
			});
			$('#win-QiXieAllocation').window('open');
		}
	});
	
	//损益
	$('#warehouse-sy').linkbutton({
		onClick: function(){
			$('#win-QiXieProfitLoss').window({
				'href':"toThpQiXieProfitAndLoss"
			});
			$('#win-QiXieProfitLoss').window('open');
		}
	});
	
	//盘点
	$('#warehouse-pd').linkbutton({
		onClick: function(){
			$('#win-QiXieCheck').window({
				'href':"toQiXieMakeAnInventory"
			});
			$('#win-QiXieCheck').window('open');
		}
	});
	
	//审核
	$('#warehouse-cgsh').linkbutton({
		onClick: function(){
			$('#win-QiXieToExamine').window({
				'href':"toexaminePurchasePlan"
			});
			$('#win-QiXieToExamine').window('open');
		}
	});
})
</script>
<style type="text/css">
	.thpckinfo{
		float: left;
		list-style: none;
	}
</style>
<body>
	<table id="thptb-warehouse" class="easyui-datagrid"
		data-options="url:'queryHisInventoryByPage',
			fitColumns:true,
			fit:true,
			pagination: true,
			pageSize: 10,
			pageList: [5,10,15,20],
			singleSelect: true,
			rownumbers: true,
			toolbar: '#warehouse_tb',
			border:false
			">
		<thead>
			<tr>
				<th data-options="field:'kcNo',width:'10%'">详情编号</th>
				<th data-options="field:'ckNo',width:'15%'">仓库编号</th>
				<th data-options="field:'kcName',width:'15%'">产品名称</th>
				<th data-options="field:'kcNumber',width:'10%'">库存数量</th>
				<th data-options="field:'kcUnit',width:'10%'">产品单位</th>
				<th data-options="field:'kcType',width:'20%'">产品类型</th>
				<th data-options="field:'kcWarning',width:'20%'">预警值</th>
			</tr>
		</thead>
	</table>
	
	<div id="warehouse_tb">
		<a id="warehouse-cgjh" class="easyui-linkbutton" data-options="iconCls:'icon-thppurchasePlan',plain:true">制定采购计划</a>
		<a id="warehouse-cgsh" class="easyui-linkbutton" data-options="iconCls:'icon-thpToExamine',plain:true">审核</a>
		<a id="warehouse-cg" class="easyui-linkbutton" data-options="iconCls:'icon-purchase',plain:true">器械采购</a>
		<a id="warehouse-ys" class="easyui-linkbutton" data-options="iconCls:'icon-thpCheckAndAccept',plain:true">器械验收</a>
		<a id="warehouse-rk" class="easyui-linkbutton" data-options="iconCls:'icon-storage',plain:true">器械入库</a>
		<a id="warehouse-th" class="easyui-linkbutton" data-options="iconCls:'icon-returnGoods',plain:true">器械退货</a>
		<a id="warehouse-ck" class="easyui-linkbutton" data-options="iconCls:'icon-outgoing',plain:true">器械出库</a>
		<a id="warehouse-ly" class="easyui-linkbutton" data-options="iconCls:'icon-recipients',plain:true">器械领用</a>
		<a id="warehouse-hh" class="easyui-linkbutton" data-options="iconCls:'icon-return',plain:true">器械还回</a>
		<a id="warehouse-db" class="easyui-linkbutton" data-options="iconCls:'icon-thpAllocation',plain:true">器械调拨</a>
		<a id="warehouse-sy" class="easyui-linkbutton" data-options="iconCls:'icon-thpProfitLoss',plain:true">器械损益</a>
		<a id="warehouse-pd" class="easyui-linkbutton" data-options="iconCls:'icon-thpCheck',plain:true">器械盘点</a>
		<a id="warehouse-yjz" class="easyui-linkbutton" data-options="iconCls:'icon-thpEarlyWarning',plain:true">编辑预警值</a>
		<a id="warehouse-reload" class="easyui-linkbutton" data-options="iconCls:'icon-thpreload',plain:true">刷新</a>
		<input id="warehouse-search" class="easyui-searchbox" data-options="menu: '#thpmm', width: 220, prompt: '请输入产品信息'"/>
	</div>
	<div id="thpmm" style="width:120px">
	    <div data-options="name:'kcType',iconCls:'icon-thptype'">产品类型</div>
	    <div data-options="name:'kcName',iconCls:'icon-thpproduct'">产品名称</div>
	    <div data-options="name:'ckNo',iconCls:'icon-thpID'">仓库编号</div>
	</div>
	<!-- 编辑预警值 -->
	<div id="win-edityjz" class="easyui-window" title="编辑预警值" data-options="
		collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		iconCls:'icon-thpEarlyWarning',
		closed: true" 
		style="width:400px;height:300px;">
		<div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<form id="form-edityjz" method="post">
					<ul id="thpyjz" style="border:0px solid red;overflow: hidden;">
						<li class="thpckinfo" style="margin:0px 20px 0px 0px;">详情编号&nbsp;<input name="kcNo" class="easyui-textbox" data-options="width: 100" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:0px 20px 0px 0px;">仓库编号&nbsp;<input name="ckNo" class="easyui-textbox" data-options="width: 100" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:10px 20px 0px 0px;">产品名称&nbsp;<input name="kcName" class="easyui-textbox" data-options="width: 270" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:10px 20px 0px -11px;">库存总数量&nbsp;<input name="kcTotalnumber" class="easyui-textbox" data-options="width: 100" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:10px 20px 0px 0px;">库存数量&nbsp;<input name="kcNumber" class="easyui-textbox" data-options="width: 100" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:10px 20px 0px 0px;">产品单位&nbsp;<input name="kcUnit" class="easyui-textbox" data-options="width: 100" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:10px 20px 0px 0px;">产品类型&nbsp;<input name="kcType" class="easyui-textbox" data-options="width: 100" readonly="readonly"></li>
						<li class="thpckinfo" style="margin:10px 20px 0px 12px;">预警值&nbsp;<input id="Warning" name="kcWarning" class="easyui-numberspinner" data-options="min:1,width: 270"></li>
					</ul>
				</form>
			</div>
			<div data-options="region:'south',border:false" style="text-align:right;border-top:1px solid #95b8e7;padding: 5px 20px 5px 0px;">
				<a id="submit_thpWarning" class="easyui-linkbutton" data-options="iconCls:'icon-ok', plain:true" >确定</a>
				<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel', plain:true" href="javascript:$('#win-edityjz').window('close');" onclick="">取消</a>
			</div>
		</div>
	</div>
	
	<!-- 制定采购计划 -->
	<div id="win-purchase" class="easyui-window" title="制定采购计划" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		iconCls:'icon-purchase',
		closed:true"
		style="width: 806px; height: 445px;">
	</div>
	
	<!-- 验收 -->
	<div id="win-CheckAndAccept" class="easyui-window" title="器械验收" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-thpCheckAndAccept'"
		style="width: 806px; height: 426px;">
	</div>
	
	<!-- 入库 -->
	<div id="win-QiXieInstorage" class="easyui-window" title="器械入库" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-storage'"
		style="width: 806px; height: 500px;">
	</div>
	
	<!-- 退货 -->
	<div id="win-QiXieReturnGoods" class="easyui-window" title="器械退货" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-returnGoods'"
		style="width: 806px; height: 500px;">
	</div>
	
	<!-- 出库 -->
	<div id="win-InstrumentLibrary" class="easyui-window" title="器械出库" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-outgoing'"
		style="width: 806px; height: 500px;">
	</div>
	
	<!-- 领用 -->
	<div id="win-QiXieUse" class="easyui-window" title="器械领用" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-recipients'"
		style="width: 806px; height: 500px;">
	</div>
	
	<!-- 还回 -->
	<div id="win-QiXieReturn" class="easyui-window" title="器械还回" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-return'"
		style="width: 806px; height: 500px;">
	</div>
	
	<!-- 调拨 -->
	<div id="win-QiXieAllocation" class="easyui-window" title="器械调拨" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-thpAllocation'"
		style="width: 650px; height: 350px;">
	</div>
	
	<!-- 损益 -->
	<div id="win-QiXieProfitLoss" class="easyui-window" title="器械损益" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-thpProfitLoss'"
		style="width: 650px; height: 400px;">
	</div>
	
	<!-- 盘点 -->
	<div id="win-QiXieCheck" class="easyui-window" title="器械盘点" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-thpCheck'"
		style="width: 806px; height: 500px;">
	</div>
	
	<!-- 审核 -->
	<div id="win-QiXieToExamine" class="easyui-window" title="计划审核" data-options="collapsible:false,
		minimizable:false,
		maximizable:false,
		modal:true,
		closed:true,
		iconCls:'icon-thpToExamine'"
		style="width: 650px; height: 400px;">
	</div>
</body>
</html>